package operation;

import book.BookList;

public class ShowOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("展示图书!");
        int curSize=bookList.getUsedSize();
        if(curSize==0) {
            System.out.println("没有图书");
            return;
        }
        for (int i = 0; i < curSize; i++) {
            System.out.println(bookList.getBook(i));  //这里的getbook返回的是一个book引用，因为book中重写了tostring方法，所以不会打印地址
        }
    }
}
